<form action="<?php echo $_SERVER['PHP_SELF'];?>" method="post" id="form">
		    	<table>
		    		<tr>
		    			<td><label for="username">Username:</label></td>
		    			<td><label for="password">Password:</label></td>
		    		</tr>
		    		<tr>
		    			<td><input type="text" name="username" id="username" /></td>
		    			<td><input type="password" name="password" id="password" /></td>
		    			<td><input type="submit" name="submit" value="Log In" id="submit" /></td>
		    		</tr>
		    		<tr><td><a id='regquest' href='registration.php'>Not a regestered user?</a></td>
		    		</tr>
		    	</table>
</form>
<?php 
	require_once 'dbconnection.php';
	
	if(isset($_POST['submit']))
	{
		
		$username =  $_POST['username'];
		$password = $_POST['password'];
		$correctData = isUserExists($username, $password);
		
		if($correctData){
			session_start();
			$_SESSION["userLogged"] = true;
			$_SESSION["username"] = $username;
			header("Location:index.php?page=homepage");
		}
		else {
			$_SESSION["userLogged"] = false;
		}
	}
	else
	{
		$_SESSION["userLogged"] = false;
	}
?>